/*     */ package com.qmsk.business.member.memberServiceDetail.controller;
/*     */ 
/*     */ import com.qmsk.business.member.memberServiceDetail.dao.MemberServiceDetailDAO;
/*     */ import com.utils.gson.in.GsonHeadOneRow;
/*     */ import com.utils.gson.out.GsonEbRst;
/*     */ import com.utils.jdbc.connection.DbConnection;
/*     */ import com.utils.web.RequestUtils;
/*     */ import com.utils.web.ResponseUtils;
/*     */ import java.sql.SQLException;
/*     */ import javax.servlet.http.HttpServletRequest;
/*     */ import javax.servlet.http.HttpServletResponse;
/*     */ import org.apache.log4j.Logger;
/*     */ import org.springframework.beans.factory.annotation.Autowired;
/*     */ import org.springframework.stereotype.Controller;
/*     */ import org.springframework.transaction.annotation.Transactional;
/*     */ import org.springframework.web.bind.annotation.PathVariable;
/*     */ import org.springframework.web.bind.annotation.RequestMapping;
/*     */ 
/*     */ @Controller
/*     */ @RequestMapping({"/memberSrvDetil"})
/*     */ public class MemberServiceDetailController
/*     */ {
/*  28 */   private static final Logger logger = Logger.getLogger(MemberServiceDetailController.class);
/*     */ 
/*     */   @Autowired
/*     */   private MemberServiceDetailDAO dao;
/*     */ 
/*     */   @RequestMapping(value={"find/memberId/{memberId}"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*     */   public void getListMemberId(HttpServletRequest request, HttpServletResponse response, @PathVariable("memberId") Integer memberId)
/*     */   {
/*     */     try
/*     */     {
/*  53 */       GsonEbRst gsonEbRst = this.dao.getGsonOfMemberId(memberId);
/*  54 */       ResponseUtils.setResponseResult(gsonEbRst, response);
/*     */     } catch (SQLException e) {
/*  56 */       logger.error(e);
/*  57 */       ResponseUtils.setErrorMsgResponse(
/*  58 */         RequestUtils.getFindDataErrorMessage(request), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @Transactional
/*     */   @RequestMapping(value={"insert"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*     */   public void insert(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/*  74 */     String sGsonInData = request.getParameter("data");
/*     */     try
/*     */     {
/*  77 */       int nResult = this.dao.insertJsonOneRow(sGsonInData);
/*  78 */       DbConnection.commit();
/*  79 */       ResponseUtils.setSqlResultResponse(nResult, 
/*  80 */         RequestUtils.getSqlInsertDataErrorMessage(request), 
/*  81 */         response);
/*     */     } catch (Exception e) {
/*  83 */       DbConnection.rollback();
/*  84 */       logger.error(e);
/*  85 */       ResponseUtils.setErrorMsgResponse(
/*  86 */         RequestUtils.getSqlInsertDataErrorMessage(request) + ":" + 
/*  87 */         e.getMessage(), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @Transactional
/*     */   @RequestMapping(value={"del"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*     */   public void delete(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/* 103 */     String id = RequestUtils.getStringOfId(request);
/*     */     try {
/* 105 */       String[] strParams = id.split(",");
/* 106 */       int nResult = this.dao.deleteParams(strParams);
/* 107 */       DbConnection.commit();
/* 108 */       ResponseUtils.setSqlResultResponse(nResult, 
/* 109 */         RequestUtils.getSqlDeleteDataErrorMessage(request), 
/* 110 */         response);
/*     */     } catch (Exception e) {
/* 112 */       DbConnection.rollback();
/* 113 */       logger.error(e);
/* 114 */       ResponseUtils.setErrorMsgResponse(
/* 115 */         RequestUtils.getSqlDeleteDataErrorMessage(request) + ":" + 
/* 116 */         e.getMessage(), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @Transactional
/*     */   @RequestMapping(value={"edit"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*     */   public void update(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/* 133 */     String id = request.getParameter("id");
/* 134 */     String sGsonInData = request.getParameter("data");
/*     */     try {
/* 136 */       GsonHeadOneRow g = GsonHeadOneRow.jsonStrToObject(sGsonInData);
/* 137 */       if (g == null) {
/* 138 */         ResponseUtils.setErrorMsgResponse(
/* 139 */           RequestUtils.getReadJsonDataErrorMessage(request), 
/* 140 */           response);
/*     */       } else {
/* 142 */         int nResult = this.dao.updateJsonOneRow(g, id);
/* 143 */         ResponseUtils.setSqlResultResponse(nResult, 
/* 144 */           RequestUtils.getSqlUpdateErrorMessage(sGsonInData, request), 
/* 145 */           response);
/*     */       }
/* 147 */       DbConnection.commit();
/*     */     } catch (Exception e) {
/* 149 */       DbConnection.rollback();
/* 150 */       logger.error(e);
/* 151 */       ResponseUtils.setErrorMsgResponse(
/* 152 */         RequestUtils.getSqlUpdateErrorMessage(sGsonInData, request) + 
/* 153 */         ":" + e.getMessage(), response);
/*     */     }
/*     */   }
/*     */ }

/* Location:           C:\Users\Administrator\Desktop\新建文件夹\WEB-INF\classes\
 * Qualified Name:     com.qmsk.business.member.memberServiceDetail.controller.MemberServiceDetailController
 * JD-Core Version:    0.5.3
 */